
const { defineConfig } = require('@vue/cli-service')
// import path from 'path'
// const path = require('node:path');
// import Vue from '@vitejs/plugin-vue'
// import Icons from 'unplugin-icons/vite'
// import IconsResolver from 'unplugin-icons/resolver'
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
// import Inspect from 'vite-plugin-inspect'
// const pathSrc = path.resolve(__dirname, 'src')
module.exports = defineConfig({
  // resolve: {
  //   alias: {
  //     '@': pathSrc,
  //   },
  // },
  transpileDependencies: true,
  lintOnSave: false,//设置是否在开发环境下每次保存代码时都启用 eslint验证
  // css相关配置
  css: {
    // css预设器配置项
    loaderOptions: {
      scss: {
        additionalData: `@import "./src/styles/main.scss";`//主入口css文件路径
      }
    }
  },

  // 设置插件配置
  configureWebpack: {
    plugins: [
      // Vue(),
      AutoImport({
        // Auto import functions from Element Plus, e.g. ElMessage, ElMessageBox... (with style)
        // 自动导入 Element Plus 相关函数，如：ElMessage, ElMessageBox... (带样式)
        resolvers: [
          ElementPlusResolver(),
          // Auto import icon components
          // 自动导入图标组件
          // IconsResolver({
          //   prefix: 'Icon',
          // }),
        ],
        // Auto import functions from Vue, e.g. ref, reactive, toRef...
        // 自动导入 Vue 相关函数，如：ref, reactive, toRef 等
        imports: ['vue'],
        // dts: path.resolve(pathSrc, 'auto-imports.d.ts'),
      }),
      Components({
        resolvers: [
          // Auto register Element Plus components
          // 自动导入 Element Plus 组件
          ElementPlusResolver(),
          // Auto register icon components
          // 自动注册图标组件
          // IconsResolver({
          //   enabledCollections: ['ep'],
          // }),
        ],
        // dts: path.resolve(pathSrc, 'components.d.ts'),
      }),
      // Icons({
      //   autoInstall: true,
      // }),

      // Inspect(),
    ]
  },

  // plugins: [
  //   require('unplugin-auto-import/webpack').default({ /* options */ }),
  // ],

})
